# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=spot
pkgver=0.4.1
pkgrel=0
pkgdesc="Native Spotify client for the GNOME desktop"
url="https://github.com/xou816/spot"
# s390x: incompatible with nix crate
# loongarch64: libc crate fails to build
arch="all !s390x !loongarch64"
license="MIT"
makedepends="
	alsa-lib-dev
	bash
	blueprint-compiler
	cargo
	curl-dev
	desktop-file-utils
	glib-dev
	gst-plugins-base-dev
	gstreamer-dev
	gtk4.0-dev
	libadwaita-dev
	libhandy1-dev
	meson
	nghttp2-dev
	openssl-dev>3
	pulseaudio-dev
	"
subpackages="$pkgname-lang"
source="https://github.com/xou816/spot/archive/$pkgver/spot-$pkgver.tar.gz
	appdata.patch
	pulseaudio-backend-only.patch
	"
options="net" # cargo fetch


build() {
	# NOTE: buildtype must be release!
	abuild-meson \
		-Doffline=false \
		--buildtype=release \
		. output
	meson compile -C output
}

check() {
	# Meson eats stdout/stderr, so run cargo directly.
	cargo test --locked
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
05ee8ce9277230a0f6c25411b41788a508551a61cd436bdd6bb0d8245030b0523232c0e30c7d2f98977382e687ec0f502cb6eb9b95a7dbaae97042ec596f407e  spot-0.4.1.tar.gz
77b0abec9fbcbc7360f54ef5dcbaf68b636ce6ea442c0e2c9fed4c8359dfa4ef5af481f87eea83860bdfda12954c6858d5cc9c9999ca1cd1e17999e29f69a58e  appdata.patch
6dd52978436158222518170cd079cc0999ae36729645fc8c4bbd76a12532ae6c2937e4ff075070177f37ebdadca306e5968a962c44ee4069d94ae2f1ea9b781b  pulseaudio-backend-only.patch
"
